package com.genghis.ptas.util;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: gaoyang
 * To change this template use File | Settings | File Templates.
 */
public class ExtremeValue {
    private double upper;
    private double lower;
    private int rankNum;
    private int groupNum;
    private List<ExtremeValue> rankNumList;

    public ExtremeValue() {
    }

    public ExtremeValue(double lower, double upper) {
        this.upper = upper;
        this.lower = lower;
    }

    public ExtremeValue(double lower, double upper, int rankNum) {
        this.upper = upper;
        this.lower = lower;
        this.rankNum = rankNum;
    }

    public double getUpper() {
        return upper;
    }

    public void setUpper(double upper) {
        this.upper = upper;
    }

    public double getLower() {
        return lower;
    }

    public void setLower(double lower) {
        this.lower = lower;
    }

    public int getRankNum() {
        return rankNum;
    }

    public void setRankNum(int rankNum) {
        this.rankNum = rankNum;
    }

    public List<ExtremeValue> getRankNumList() {
        return rankNumList;
    }

    public int getGroupNum() {
        return groupNum;
    }

    public void setGroupNum(int groupNum) {
        this.groupNum = groupNum;
    }

    public void setRankNumList() {
        double stepLength = (upper - lower) * 1.0 / groupNum;
        List<ExtremeValue> rankNumTemp = new ArrayList<ExtremeValue>();
        double cursor = lower;
        for (int s = 0; s < groupNum; s++) {
            //设置每个分段内部的上下界
            rankNumTemp.add(new ExtremeValue(cursor, cursor + stepLength));
            cursor = cursor + stepLength;
        }
        this.rankNumList = rankNumTemp;
    }

    public void setRankNumList(List<ExtremeValue> rankNumList) {
        this.rankNumList = rankNumList;
    }
}
